package com.myblog.controller;

import com.myblog.domain.GlobalResponse;
import com.myblog.domain.entity.User;
import com.myblog.services.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Api(tags = "用户控制器")
public class UserController {

    @Resource
    UserService userService;
    @ApiOperation("获取用户信息")
    @GetMapping("/userInfo")
    public GlobalResponse getUserInfo(){
        return userService.getUserInfo();
    }
    @ApiOperation("更新用户信息")
    @PutMapping("/userInfo")
    public GlobalResponse updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }
    @ApiOperation("注册")
    @PostMapping("/register")
    public GlobalResponse register(@RequestBody User user){
        return userService.register(user);
    }
}
